<template>
  <div>
    <div v-if="user">
      <el-row >
        <el-col>
          <el-card>
            <el-tabs v-model="activeTab">
              <el-tab-pane label="账号信息" name="account">
                <account :user="user"/>
              </el-tab-pane>
              <el-tab-pane label="个人密码" name="password">
                <password user="user"/>
              </el-tab-pane>
            </el-tabs>
          </el-card>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
  import Password from './Password'
  import Account from './Account'

  export default {
    name: 'Profile',
    components: {Password, Account},
    data() {
      return {
        activeTab: '',
        user: {
          cname:null,
          photoUrl:null,
        }
      }
    },
    computed: {
    },
    created() {
      this.activeTab = 'account'
    },
    mounted() {
      this.initUser();
    },
    methods: {
      initUser() {
        this.$https.get('/getUserInfo',{}).then(res=>{
          if (res.data.data) {
            this.user = res.data.data;
          }
        })
      },
    }
  }
</script>

